import request from '@/utils/request'

// 获取角色列表
export const getRoleListApi = (page, pagesize) => {
  return request.get('/sys/role',
    {
      params: {
        page,
        pagesize
      }
    })
}

// 删除角色
export const delRoleApi = (id) => {
  return request.delete(`/sys/role/${id}`)
}

// 编辑角色
export const editRoleApi = (data) => {
  return request.put(`/sys/role/${data.id}`, data)
}

// 新增接口
export const addRoleApi = (data) => {
  return request.post('/sys/role', data)
}

// 获取编辑角色详情
export const getRoleDetailsApi = (id) => {
  return request.get(`/sys/role/${id}`)
}

// 获取公司详情
export const getCompanyDataApi = (id) => {
  return request.get(`/company/${id}`)
}

/** *
 * 给员工分配角色
 * ***/
export function assignRolesApi(data) {
  return request({
    url: '/sys/user/assignRoles',
    method: 'put',
    data
  })
}

// 分配权限-角色
export const authorityOfDistributionApi = (data) => {
  return request.put('/sys/role/assignPrem', data)
}
